package com.kang.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.kang.pojo.ItemDetail;
import com.kang.pojo.StorageDistribute;
import com.kang.pojo.Storagedistribte_iteminformation;
import com.vonechina.entity.page.ItemDetailPage;
import com.vonechina.entity.page.StorageDistributePage;

/**
 * 库存调配
 * 
 * @author ysq
 *
 */
public interface StorageDistributeMapper {

	/**
	 * 查询StorageDistribute库存调配总条数
	 * 
	 * @param storageDistributePage
	 * @return
	 */
	public int selectByWheresSum(StorageDistributePage storageDistributePage);

	/**
	 * 查询StorageDistribute库存调配
	 * 
	 * @param storageDistributePage
	 * @return
	 */
	public List<Map<?, ?>> selectByWheres(
			StorageDistributePage storageDistributePage);

	/**
	 * 根据storageDistributeID删除storagedistribute库存调配
	 * 
	 * @param storageDistributeID
	 * @return
	 */
	public int deleteStoragedistribute(Integer storageDistributeID);

	/**
	 * 根据storageDistributeID查询storagedistribute库存调配
	 * 
	 * @param storageDistributeID
	 * @return
	 */
	public StorageDistribute selectStoragedistributeByStorageDistributeID(
			int storageDistributeID);

	/**
	 * 添加库存调配信息
	 * 
	 * @param storageDistribute
	 * @return
	 */
	public int addStorageDistribute(StorageDistribute storageDistribute);

	/**
	 * 修改库存调配信息
	 * 
	 * @param storageDistribute
	 * @return
	 */
	public int updateStorageDistribute(StorageDistribute storageDistribute);

	/**
	 * 生成库存调配单号
	 * 
	 * @return
	 */
	public String selectMaxDistributeNumber();

	/**
	 * 查询item_detail表
	 * 
	 * @param itemDetailPage
	 * @return
	 */
	public List<Map<?, ?>> selectItemDetailList(ItemDetailPage itemDetailPage);

	/**
	 * 查询item_detail表总条数
	 * 
	 * @param itemDetailPage
	 * @return
	 */
	public int selectItemDetailListSum(ItemDetailPage itemDetailPage);

	/**
	 * 保存库存调配详情
	 * 
	 * @param storagedistribte_iteminformation
	 * @return
	 */
	public int addStoragedistribte_iteminformation(
			Storagedistribte_iteminformation storagedistribte_iteminformation);

	/**
	 * 根据id查询出item_detail
	 * 
	 * @param id
	 * @return
	 */
	public ItemDetail selectItem_detailById(Integer id);

	/**
	 * 添加item_detai
	 * 
	 * @param item_detail
	 * @return
	 */
	public Integer addItem_detail(ItemDetail item_detail);

	/**
	 * 根据id修改item_detail数量
	 * 
	 * @param item_detailId
	 * @param number
	 * @return
	 */
	public Integer updateItem_detail(
			@Param("item_detailId") Integer item_detailId,
			@Param("number") Integer number);

	/**
	 * 根据id修改item_detail数量 加上原有数量
	 * 
	 * @param item_detailId
	 * @param number
	 * @return
	 */
	public Integer updateItem_detailNumber(
			@Param("item_detailId") Integer item_detailId,
			@Param("number") Integer number);

	/**
	 * 根据批次号和仓库id查询出数据库是否已经存在数据，存在则修改，否则添加
	 * 
	 * @param batchNumber
	 * @param warehouseManagementID
	 * @return
	 */
	public ItemDetail selectItem_detailByCondition(
			@Param("batchNumber") String batchNumber,
			@Param("warehouseManagementID") Integer warehouseManagementID);

	/**
	 * 根据storageDistributeID查询库存调配详情_物品信息
	 * 
	 * @param storageDistributeID
	 * @return
	 */
	public List<Map<?, ?>> selectStoragedistribteIteminformationByStorageDistributeID(
			Integer storageDistributeID);

	/**
	 * 根据storageDistribteID删除所有storagedistribte_iteminformation信息
	 * 
	 * @param storageDistribteID
	 * @return
	 */
	public Integer delStoragedistribteIteminformation(Integer storageDistribteID);
}
